package com.rtx.model.dto.response;

import java.io.Serializable;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 接口平台-新开发的接口-响应对象
 *
 * @author Zy
 */
@ApiModel("统一返回相应参数实体类")
public class ApiResponse<T> implements Serializable {

    private static final long serialVersionUID = -1241360949457314497L;

    @ApiModelProperty("返回实体")
    private T data;

    @ApiModelProperty("响应消息")
    private String returnMgr;

    @ApiModelProperty("响应码")
    private Integer returnCode;

    public ApiResponse() {
        this.returnCode = ResultCode.SUCCESS.getCode();
        this.returnMgr = ResultCode.SUCCESS.getMessage();
    }

    public ApiResponse(T data) {
        this.data = data;
        this.returnCode = ResultCode.SUCCESS.getCode();
        this.returnMgr = ResultCode.SUCCESS.getMessage();
    }

    public ApiResponse(Integer returnCode, String returnMgr) {
        this.returnMgr = returnMgr;
        this.returnCode = returnCode;
    }

    public ApiResponse(T data, ResultCode resultCode) {
        this.data = data;
        this.returnMgr = resultCode.getMessage();
        this.returnCode = resultCode.getCode();
    }

    public ApiResponse(T data, Integer returnCode, String returnMgr) {
        this.data = data;
        this.returnCode = returnCode;
        this.returnMgr = returnMgr;
    }
}
